//
//  BConst.m
//  Bullet
//
//  Created by  on 2019/9/18.
//  Copyright © 2019 . All rights reserved.
//

#import "BConst.h"

NSString * const VIDEO_LOADING_CACHE_MAP_KEY = @"kVIDEO_LOADING_CACHE_MAP_KEY";
NSString * const VIDEO_LOCAL_CACHE_MAP_KEY = @"kVIDEO_LOCAL_CACHE_MAP_KEY";
NSString * const VIDEO_FINISHED_CACHE_MAP_KEY = @"kVIDEO_FINISHED_CACHE_MAP_KEY";

NSString * const ADVERTISE_USERDEFAULT_KEY = @"getAdvertList";
NSString * const LOGIN_USERDEFAULT_KEY = @"loginuserInfo";

NSString * const VIDEO_CACHE_TIME_FORMATE_KEY = @"yyyyMMddHHmmss";

NSString * const UPLOAD_USERDEFAULT_KEY = @"kUPLOAD_USERDEFAULT_KEY";



@implementation BConst


+ (void)openUrlWithStr:(NSString *)urlstr{
    
    if(IS_NULL_STR(urlstr)){
        return;
    }
    
    if(![urlstr containsString:@"https"] || ![urlstr containsString:@"http"]){
        urlstr = [NSString stringWithFormat:@"http://%@",urlstr];
    }
    NSURL *url = [NSURL URLWithString:urlstr];
    if(!url){
        return;
    }
    
    if(![[UIApplication sharedApplication] canOpenURL:url]){
//        BLog(@"open url failed,can not open url.");
        return;
    }
    
    if ([UIDevice currentDevice].systemVersion.doubleValue >= 10.0) {
        [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
            if (success) {
            }
            else
            {
//                BLog(@"open url failed");
            }
        }];
    }
    else
    {
        [[UIApplication sharedApplication] openURL:url];
    }
}

@end
